package com.alibaba.dubbo.remoting;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

import com.alibaba.dubbo.common.extension.SPI;

/**
 * MessageCodec. (SPI, Singleton, ThreadSafe)
 * 
 * @author kingbo.ruan
 */
@SPI
public interface MessageEncode extends MessageCodec {
	 
	/**
	 * 
	 * @param length 输入流中数据的有效长度
	 * @param in
	 * @param out
	 * @return
	 * @throws IOException
	 */
	int encode(InputStream in, OutputStream out/*, MessageEncodeRegistry registry*/) throws IOException;
}
